# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=logrotate
pkgver=3.17.0
pkgrel=0
pkgdesc="Tool to rotate logfiles"
url="https://github.com/logrotate/logrotate"
arch="all"
license="GPL-2.0-or-later"
makedepends="popt-dev autoconf automake libtool"
subpackages="$pkgname-doc $pkgname-openrc"
source="$url/releases/download/$pkgver/$pkgname-$pkgver.tar.xz
	logrotate.cron
	logrotate.conf
	logrotate.confd"

prepare() {
	default_prepare

	./autogen.sh
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

package() {
	make DESTDIR="$pkgdir" install

	install -dm755 "$pkgdir"/etc/logrotate.d/
	install -Dm644 ../logrotate.conf \
		"$pkgdir"/etc/logrotate.conf

	install -Dm755 "$srcdir"/logrotate.cron \
		"$pkgdir"/etc/periodic/daily/logrotate
	install -Dm644 "$srcdir"/logrotate.confd  \
		"$pkgdir"/etc/conf.d/logrotate
}

sha512sums="41c0793e4e1441b7d35b301f1d7a80b84e03dbb0426c7c60422649b9041a01b32b095ec0759f9eeac7dfe783fc15b454e1ed237a72414e2c5c31ac591d5978ba  logrotate-3.17.0.tar.xz
f4d708594fb2b240cfc2928f38a180d27c2cecb9867e048dc29a32c0147244db4d2f6d92e7bff27e1f2623537587db87b2f8fc9bb988f98eff0c98f79f5a5bf2  logrotate.cron
9e6a1d024b1cf1ddb8b631fdc1379bfecbfeb1af873930d2a19d32313b26881926df5c21b47b55ada2b6012be981ec2d6d8fa2f249a68b61fd2c97c32f52a957  logrotate.conf
be9f0043b594d26b4f64e07a2188d19c3c43af75ef726305e4d98f744fc16cee9f280227116858e2f5b781c0a7b58e0209d7e9ab1285dfa7ba55a9dfda700229  logrotate.confd"
